<?php 

include ('user.function.php');

// Cette fonction devra etre appeler pour les valeur de base du google chart
function formateSelectAll(){
	$resultat=$connexion->query("select * from users");

	$tabResultat=$resultat->fetchAll();
	$retour ='[';
	foreach($tabResultat as $result){
		$retour.='[';		
		foreach($result as $ligne){
			 $retour.=$ligne.',';
		}
		$retour=substr($retour,0,-1);
		$retour.='],';
	}
	$retour=substr($retour,0,-1);
	$retour.=']';
}

?>

<html>
  <head>
    <script type='text/javascript' src='https://www.google.com/jsapi'></script>
    <script type='text/javascript'>
      google.load('visualization', '1', {packages:['table']});
      google.setOnLoadCallback(drawTable);
      function drawTable() {
        var data = new google.visualization.DataTable();
       	data.addColumn('number', 'id');
        data.addColumn('string', 'titre');
       	data.addColumn('string', 'prenom');
       	data.addColumn('string', 'nom');
       	
     //   data.addColumn('boolean', 'Full Time Employee');
        data.addRows([
          [1,'Mr' ,'Mike' ,'Do' ],
          [2, 'Mr' ,'Jim','Do' ],
          [3,'Mme' ,'Alice','Do' ],
          [4, 'Mr', 'Bob','Do' ]
        ]);

        var table = new google.visualization.Table(document.getElementById('table_div'));
        table.draw(data, {showRowNumber: true});
      }
    </script>
  </head>
  <body>
    <div id='table_div'></div>
  </body>
</html>
